package com.example.factory_bean;

import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Component;

@Component
public class MyFactoryBean implements FactoryBean, InitializingBean {

    Class clazzInterface;
    Object clazz;

    @Override
    public Object getObject() throws Exception {
        afterPropertiesSet();
//        return new GuoQing();
        return this.clazz;
    }

    @Override
    public Class<?> getObjectType() {
        return GuoQing.class;
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        this.clazz = new GuoQing();
    }
}
